# @Time : 2024-10-22 18:07
# @Author : Fioman 
# @Phone : 13149920693
# region 1. 带符号保留小数点后两位 {:+2.f}
pi = 3.1415926
print(f"{pi:+.2f}")
a = -123.0
print(f"{a:+.2f}")
# endregion

# region 2. 不带小数,只保留整数,四舍五入 {:.0f}
a = 2.781828
print(f"{a:.0f}")
b = 2.4818
print(f"{b:.0f}")
# endregion

# region 3. 数字补零(填充左边,宽度为10) {:0>10d}
a = 123
print(f"{a:0>10d}")
# endregion

# region 4. 数字补零(填充右边,宽度为10) {:0<10d}
a = 123
print(f"{a:0<10d}")
# endregion

# region 5. 以逗号分隔的方式显示数字 {:,}
a = 123456789
print(f"{a:,}")
# endregion

# region 6. 转换为百分比格式 {:.2%},保留两位小数
a = 0.2555111
print(f"{a:.2%}")
# endregion

# region 7. 指数计数法 {:.2e}
a = 10
print(f"{a:2e}")
# endregion

# region 8. 右对齐,默认宽度为10 {:>10d}
a = 123
b = 123456
print(f"{a:>10d}")
print(f"{b:>10d}")
# endregion
# region 9. 左对齐,默认宽度为10 {:<10d}
print(f"{a:<10d}")
print(f"{b:<10d}")
# endregion

# region 10. 中间对齐,默认宽度为10{:^10d}
print(f"{a:^10d}")
print(f"{b:^10d}")
# endregion
